package cn.zane.chatgpt.data.domain.auth.service;

import cn.zane.chatgpt.data.domain.auth.model.entity.AuthStateEntity;
import cn.zane.chatgpt.data.domain.auth.model.valobj.AuthTypeVO;
import lombok.extern.slf4j.Slf4j;

/**
 * @author: zane
 * @date: 2025-09-19
 * @description: 鉴权验证服务抽象类
 */
@Slf4j
public abstract class AbstractAuthService implements IAuthService {

    @Override
    public AuthStateEntity doLogin(String code) {
        // 如果不是4位有效数字字符串，则返回验证码无效
        if (!code.matches("\\d{4,8}")){
            log.info("鉴权，用户收入的验证码无效 {}", code);
            return AuthStateEntity.builder()
                    .code(AuthTypeVO.A0002.getCode())
                    .info(AuthTypeVO.A0002.getInfo())
                    .build();
        }
        return null;
    }

    protected abstract AuthStateEntity checkCode(String code);

    @Override
    public boolean checkToken(String token) {
        return false;
    }


    private boolean isVerify(String token) {
        return false;
    }
}
